package webgamemaker.FightCanvas;

import java.util.ArrayList;

public class FighterActionListe implements FighterAction 
{
	public ArrayList<FighterAction> liste;
	int current;
	
	public FighterActionListe()
	{
		liste = new ArrayList<FighterAction>();
	}
	
	public void addAction(FighterAction action)
	{
		liste.add(action);
	}
	
	public void apply(Fighter fighter) 
	{
		while(current < liste.size() && liste.get(current).isFinished(fighter))
			current++;
		if(current < liste.size())
			liste.get(current).apply(fighter);
	}
	
	public boolean isFinished(Fighter fighter)
	{
		return current == liste.size();
	}

}
